home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / t3_1 / doc.lha / documentation / manual / advice.mss next >
Text File  |  1987-06-30  |  4KB  |  109 lines

  1. @part[ADVICE, Root "TMAN.MSS"]        @Comment{-*-System:TMAN-*-}
  2. @appendix[Friendly advice]
  3.  
  4. @section[Comparison with other Lisp dialects]
  5.  
  6. Some of the terminology may take some getting used to.  We always say
  7. @i[procedure] instead of @i[function], for example.  @i[Special form]
  8. and @i[reserved word] have special meaning.  @i[Syntax] usually refers
  9. not to what the reader does but to what the compiler does.
  10. @index[functions]
  11.  
  12. As in Common Lisp, but unlike most familiar Lisp dialects besides Scheme,
  13. @Tau[] is lexically scoped.
  14.  
  15. As in Scheme, there is full support for lexical closures,
  16. and tail-recursive calls are reliably performed as jumps.
  17.  
  18. Generic operations are like message-passing.
  19. @tc[JOIN] can be used to implement object systems analogous to
  20. the Lisp Machine's flavor system.
  21.  
  22. Synonyms generalize Lisp Machine Lisp's @tc[MAKE-SYN-STREAM].
  23.  
  24. See also the equivalences appendix for some rough functional analogues.
  25.  
  26. @section[Incompatibilities]
  27.  
  28. The empty list is distinguished from the symbol whose print name
  29. is @tc["NIL"].  That is, @wt[(NEQ? NIL 'NIL)].  The @i[value] of the
  30. variable @tc[NIL] is the empty list.  The empty list is the same as the
  31. logical false value.
  32.  
  33. All @qu"global" variables must be declared using @tc[LSET] before they
  34. are assigned using @tc[SET] or @tc[BIND].  This is quite unlike most Lisp
  35. dialects where the first @tc[SETQ] causes a variable to come into existence.
  36.  
  37. @tau[] has no @tc[FEXPR] or @tc[NLAMBDA] mechanism.  Their effect may be
  38. accomplished using procedures or macros.
  39.  
  40. There are no @tc[SPECIAL] declarations and no implicit dynamic
  41. binding.  @tc[BIND] must be used explicitly when a variable is to be
  42. dynamically bound. 
  43.  
  44. @tc[COND] and @tc[CASE] don't yield nil in the fall-through case;
  45. they yield undefined values.
  46.  
  47. @tc[RETURN] and @tc[GO]-tags are not supported in @tc[DO].
  48. Lisp @tc[RETURN] may be simulated using @wt[(CATCH RETURN ...)].
  49.  
  50. @tc[NTH] is incompatible with Maclisp's function of the same name.
  51. Maclisp's takes the index as the first argument and the list as
  52. the second, instead of the other way around.
  53.  
  54. @tc[LAST] returns the last @i[element] of the list, not the
  55. last @i[pair], as in Maclisp.
  56. Maclisp's @tc[LAST] is like @tau[]'s @tc[LASTCDR].
  57.  
  58. @tc[APPEND] isn't defined to copy all but the last list.  I.e.
  59. the language definition allows the implementation to
  60. yield @tc[X], and not a copy of it, for @tc[(APPEND X '())].
  61.  
  62. @tc[PUSH]'s syntax is incompatible with that of @tc[PUSH]
  63. in Maclisp and Common Lisp.
  64.  
  65. Locatives aren't as cheap as they are in Lisp Machine Lisp; creating
  66. a locative may involve consing.
  67.  
  68. @dc{ 
  69.  
  70. @section[Style suggestions]
  71.  
  72. Coding style cannot be dictated.  The @Tau[] designers and implementors
  73. attempt to adhere to a strict programming discipline.  The less
  74. @qu"randomness" there is in a program, the easier it is to understand.
  75. The noise level must be kept to a minimum.  ...
  76.  
  77. Understand @tc[NIL], @tc[()], @tc['()], and @tc[T].
  78. As a matter of style, users are advised to write @tc[NIL] as an
  79. expression which evaluates to a logically false value, and @tc['()] as
  80. an expression which evaluates to the empty list.  Use @tc[()] in
  81. quoted structures: @wt[(CADR '(A () B)) @ev[] ()], but @wt[(CADR '(A NIL
  82. B)) @ev[] NIL].
  83.  
  84. That car and cdr of null evaluate to null is sometimes considered a
  85. programming convenience, but code which depends on this fact may be
  86. difficult to read and is considered stylistically poor.
  87.  
  88. In Maclisp-like Lisp dialects, many users program with macros as a way
  89. to get certain trivial operations to @qu"open-code."  @Tau[] provides
  90. @i[integrable procedures] (see section @Ref[DefineIntegrableSection])
  91. for that purpose, and we encourage their use.
  92.  
  93. It is usually unnecessary to use @tc[SET] on local variables.
  94. @tc[LET] and various side-effect-free iteration constructs usually
  95. suffice to express most code which in other Lisp dialects would
  96. require @tc[SET].
  97.  
  98.    Avoid irregular abbreviations.
  99.  
  100.    Indent and comment properly.
  101.  
  102.    Avoid side-effects.
  103.  
  104.    Avoid @tc[EVAL].
  105.  
  106.    Use locales sparingly.
  107.  
  108. }
  109.